import { type ColorName } from '../config/GlobalColorConfig';
import type { Api } from './SchemaModels';



export enum SearchFieldType {
    input = "input",
    inputNumber = "inputNumber",
    numberRange = "numberRange",
    select = "select",
    multiSelect = "multiSelect",
    date = "date",
    dateTimeRange = "dateTimeRange"
}

export interface SearchFieldConfig {
    field: string
    label: string
    type: string
    options?: any[]
    optionsConfig?: SearchFieldOptionsConfig
}

export interface SearchFieldOptionsConfig {
    config: {
        // 是否本地加载选项
        localLoad: boolean
        // 远程加载的url
        api?: Api
    }
    // 选项内容
    options: { label: string, value: string }[]
}

export interface ColorRule {
    min?: number;
    max?: number;
    includeMin?: boolean;
    includeMax?: boolean;
    color: ColorName;
  }
  
  export interface Column {
    field: string;
    title: string;
    sortable?: boolean;
    exportField?: string;
    colorRules?: ColorRule[];
    customRender?: string;
  }
  
  export interface TableConfig {
    data: any[];
    columnsConfig: ColumnsConfig;
    showSelection: boolean;
    height: string | number;
  }

  export interface ColumnsConfig {
    config: ConfigMeta;
    data: Column[];
  }

  export interface ConfigMeta {
    localLoad: boolean;
    api?: Api;
  }
  
  export interface ExportConfig {
    mode: string;
    columnWidth: number;
    rowHeight: number;
    border: boolean;
    setHeaderBackground: boolean;
    headerBackgroundColor: string;
  }
  export interface SearchConfig {
    fields: SearchFieldConfig[];
    api: Api;
  }

  export interface PaginationConfig {
    active: boolean; //是否启用分页组件
    total: number;
    pageSize: number;
    currentPage: number;
    pageSizeOptions: number[];
  }


